package com.sea.finance.controller;

import com.codecrane.core.controller.UploaderController;
import com.codecrane.core.util.DateUtils;
import com.codecrane.core.util.ExcelUtil;
import com.codecrane.core.web.Ajax;
import com.codecrane.core.web.AjaxReturn;
import com.codecrane.core.web.AjaxTableReturn;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sea.finance.entity.RefusedTax;
import com.sea.finance.entity.RefusedTaxRecord;
import com.sea.finance.service.RefusedTaxRecordService;
import com.sea.finance.service.RefusedTaxService;
import com.sea.supply.service.ProduceService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;


/**
 *  控制器
 * @author 陈鸿飞
 *  <br/>
 *  <br/>
 */
@Controller
@RequestMapping("/sea/finance/refusedTaxRecord")
public class RefusedTaxRecordController {

    @Autowired
    private RefusedTaxRecordService refusedTaxRecordService;



    /**
     * 分页条件查询
     *
     * @param createPlanNo
     * @return
     */
    @ResponseBody
    @RequestMapping("/findByCreatePlanNo")
    public List<RefusedTaxRecord> findByCreatePlanNo(String createPlanNo) {
        return refusedTaxRecordService.findByCreatePlanNo(createPlanNo);
    }

    /**
     * 新增
     * @param refusedTaxRecord
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public AjaxReturn save(RefusedTaxRecord refusedTaxRecord) {
        AjaxReturn result = Ajax.fail().setMsg("保存失败！");
        try{
            if (null != refusedTaxRecord && refusedTaxRecordService.save(refusedTaxRecord) > 0) {
                result.setOk(true).setMsg("保存成功！");
            }
        }catch (Exception e){
            e.printStackTrace();
            result.setMsg("系统异常,请联系管理员!");
            return result;
        }
        return result;
    }
}
